<?php

namespace app\admin\controller\check;

use app\admin\model\User;
use app\common\controller\Backend;
use app\common\library\Auth;
use think\Db;

/**
 * 课程管理
 *
 * @icon fa fa-user
 */
class AfterSale extends Backend
{

    protected $relationSearch = true;
    protected $searchFields = 'id,username,nickname';
    protected $noNeedRight = ['get_service_sales_reason', 'get_sales_reason', 'select_class_room', 'getClassRoom', 'getTeacher', 'getSchoolClass'];

    /**
     * @var \app\admin\model\User
     */
    protected $model = null;
    protected $refund_model = null;
    protected $service_model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = model('OrderServiceSales');
        $this->service_model = model('Service');
        $this->refund_model = model('StoreOrderRefund');
    }

    /**
     * 查看
     */
    public function index()
    {
        $this->relationSearch = true;
        //设置过滤方法
        $this->request->filter(['strip_tags', 'trim']);
        if ($this->request->isAjax()) {
            //如果发送的来源是Selectpage，则转发到Selectpage
            if ($this->request->request('keyField')) {
                return $this->selectpage();
            }
            $where = [];
            $filter = $this->request->get('filter');
            $offset = $this->request->get('offset');
            $order = $this->request->get('order');
            $sort = $this->request->get('sort');
            $limit = $this->request->get('limit');
            $filter = json_decode($filter,true);
            $string = '';
            foreach ($filter as $w=>$v){
                if($w=='add_time') {
                    $time_arr = explode(' - ', $v);
                    $where['s.add_time'] = ['between', [strtotime($time_arr[0]), strtotime($time_arr[1])]];
                    //  $where_new['end_time'] = ['<=',$time_arr[1]];
                }else if($w=='lift.real_name' || $w=='buildings' || $w=='order_id1'){
                    $where[$w] = ['like','%'.$v.'%'];
                }else if($w=='province' || $w=='city' || $w=='area'){
                    $string.= $v.'-';
                }else if($w=='number' || $w=='package' || $w=='duration'){
                    $where['o.'.$w] = ['like','%'.$v.'%'];
                }else if($w=='l_real_name'){
                    $where['l.real_name | c.proprietor_name'] = ['like','%'.$v.'%'];
                }else if($w=='phone'){
                    $where['l.phone | c.phone'] = ['like','%'.$v.'%'];
                }else if($w=='specifications_name'){
                    $where['o.specifications'] = ['like','%'.$v.'%'];
                }else if($w=='order_id' || $w=='id' || $w=='refund_reason' || $w=='audit_status'){
                    $where['s.'.$w] = $v;
                }else if ($w == 'lift.lift_number') {
                    $where['l.lift_number | c.elevator_no'] = ['like', '%' . $v . '%'];
                }else if ($w == 'lift_number') {
                    $where['l.lift_number | c.elevator_no'] = ['like', '%' . $v . '%'];
                }else if ($w == 'personnel_id') {
                    $where['l.personnel_id'] = $v;
                }
            }
            if($string){
                $string = substr($string, 0, -1);
                $where['l.area | c.address'] = $string;
            }
            $count = $this->refund_model
                ->alias('s')
                ->join('store_order o','o.id = s.store_order_id','left')
                ->join('free_clean c','c.id = o.free_clean_id','left')
                ->join('lift l','o.lift_id = l.id','left')
                ->count();
            $list = $this->refund_model->alias('s')
                ->join('store_order o','o.id = s.store_order_id','left')
                ->join('lift l','o.lift_id = l.id','left')
                ->join('free_clean c','c.id = o.free_clean_id','left')
                ->where($where)
                ->order('s.add_time desc')
                ->field('s.*,l.*,l.real_name as l_real_name,l.id as l_id,o.*,o.id as o_id,s.id as id,s.refund_reason as refund_reason')
                ->limit($offset, $limit)
                ->select();
            foreach ($list as $w => &$v) {
                $v['add_time'] = $v['add_time'] ? date('Y-m-d H:i:s', $v['add_time']) : '';
                $v['u_real_name'] = Db::name('user')->where(['uid'=>$v['personnel_id']])->value('real_name');
//                if ($v['service']['cleaning_id'] > 0) {
//                    $v['cleaner_name'] = \app\admin\model\Cleaner::where(['uid' => $v['service']['cleaning_id']])->value('cleaner_name');
//                }
                if ($v['free_clean_id'] > 0) {
                    $elevator_no = Db::name('free_clean')->where(['id' => $v['free_clean_id']])->find();
                    $v['lift_number'] =  $elevator_no['elevator_no'];
                    $v['area'] =  $elevator_no['address'];
                    $v['buildings'] =  $elevator_no['buildings'];
                    $v['l_real_name'] =  $elevator_no['proprietor_name'];
                    $v['phone'] =  $elevator_no['phone'];
                    $v['specific_address'] =  $elevator_no['specific_address'];
                    $v['specific_address'] =  $elevator_no['specific_address'];
                    //   var_dump($v['lift']);
                }
            }
            $sql = $this->refund_model->getLastSql();
            $result = array("total" => $count, "rows" => $list, 'sql' => $sql);

            return json($result);
        }
        return $this->view->fetch();
    }

    /**
     * 添加
     */
    public function add()
    {
        if ($this->request->isPost()) {
            $params = $this->request->post("row/a");
            $params['create_time'] = time();
            $params['admin_id'] = $this->auth->id;
            $image_arr = explode('aliyuncs.com', $params['logo']);
            if ($params['logo']) {
                $params['logo'] = $image_arr[1];
            }
            $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
            $randStr = str_shuffle($str);
            $rands = substr($randStr, 0, 6);
            $params['code'] = $rands;
            $res = $this->model->insert($params);
            if ($res) {
                $this->success();
            }
            $this->error();
        }
        return $this->view->fetch();
    }

    /**
     * 编辑
     */
    public function edit($ids = '')
    {
        $row = $this->model->get($ids);
        if (!$row) {
            $this->error(__('No Results were found'));
        }
        if ($this->request->isPost()) {
            $params = $this->request->post("row/a");
            if ($params) {
                try {
                    $params['update_time'] = time();
                    $params['admin_id'] = $this->auth->id;
                    $image_arr = explode('aliyuncs.com', $params['logo']);
                    if ($params['logo']) {
                        $params['logo'] = $image_arr[1];
                    }
                    $result = $row->allowField(true)->save($params);
                    if ($result !== false) {
                        $this->success();
                    } else {
                        $this->error($row->getError());
                    }
                } catch (\think\exception\PDOException $e) {
                    $this->error($e->getMessage());
                } catch (\think\Exception $e) {
                    $this->error($e->getMessage());
                }
            }
            $this->error(__('Parameter %s can not be empty', ''));
        }
        if ($row['logo']) {
            $row['logo'] = 'https://yunwotuojiao.oss-cn-fuzhou.aliyuncs.com' . $row['logo'];
        }

        $this->view->assign("row", $row);
        return $this->view->fetch();
    }

    /**
     * 删除
     */
    public function del($ids = "")
    {
        if (!$this->request->isPost()) {
            $this->error(__("Invalid parameters"));
        }
        $ids = $ids ? $ids : $this->request->post("ids");
        $row = $this->model->get($ids);
        $this->modelValidate = true;
        if (!$row) {
            $this->error(__('No Results were found'));
        }
        $this->model->where(['id' => $row['id']])->delete();
        $this->success();
    }


    /**
     * 查看
     */
    public function after_sale()
    {
        $this->relationSearch = true;
        //设置过滤方法
        $this->request->filter(['strip_tags', 'trim']);
        if ($this->request->isAjax()) {
            //如果发送的来源是Selectpage，则转发到Selectpage
            if ($this->request->request('keyField')) {
                return $this->selectpage();
            }
            $where = [];
            $filter = $this->request->get('filter');
            $offset = $this->request->get('offset');
            $order = $this->request->get('order');
            $sort = $this->request->get('sort');
            $limit = $this->request->get('limit');
            $filter = json_decode($filter,true);
            $string = '';
            foreach ($filter as $w=>$v){
                if($w=='service_time' || $w=='cleaning_end_time'){
                    $time_arr = explode(' - ',$v);
                    $where['os.'.$w] = ['between',[strtotime($time_arr[0]),strtotime($time_arr[1])]];
                    //  $where_new['end_time'] = ['<=',$time_arr[1]];
                }else if($w=='add_time') {
                    $time_arr = explode(' - ', $v);
                    $where['s.add_time'] = ['between', [strtotime($time_arr[0]), strtotime($time_arr[1])]];
                    //  $where_new['end_time'] = ['<=',$time_arr[1]];
                }else if($w=='service_status' || $w=='cleaning_id'  ){
                    $where[$w] = $v;
                }else if($w=='lift_number'  || $w=='lift.real_name' || $w=='phone' || $w=='buildings'){
                    $where[$w] = ['like','%'.$v.'%'];
                }else if($w=='province' || $w=='city' || $w=='area'){
                    $string.= $v.'-';
                }else if($w=='number' || $w=='package' || $w=='duration'){
                    $where['o.'.$w] = ['like','%'.$v.'%'];
                }else if($w=='l_real_name'){
                    $where['lift.real_name'] = ['like','%'.$v.'%'];
                }else if($w=='phone'){
                    $where['lift.phone'] = ['like','%'.$v.'%'];
                }else if($w=='specifications_name'){
                    $where['os.specifications'] = ['like','%'.$v.'%'];
                }else if($w=='remark'){
                    $where['os.remark'] = $v;
                }
            }
            if($string){
                $string = substr($string, 0, -1);
                $where['l.area'] = $string;
            }
            $count = $this->model
                     ->alias('s')
                     ->join('eb_store_order_service os','os.service_id = s.service_id','left')
                     ->join('lift l','os.lift_id = l.id','left')
                     ->join('store_order o','o.id = os.order_id','left')
                     ->count();
            $list = $this->model->alias('s')
                ->join('eb_store_order_service os','os.service_id = s.service_id','left')
                ->join('lift l','os.lift_id = l.id','left')
                ->join('store_order o','o.id = os.order_id','left')
                ->where($where)
                ->order('s.add_time desc')
                ->field('s.*,l.*,l.real_name as l_real_name,l.id as l_id,o.*,os.*,o.id as o_id,os.id as os_id,s.id as id,s.number as number,os.free_clean_id as free_id')
                ->limit($offset, $limit)
                ->select();
            foreach ($list as $w => &$v) {
                $v['add_time'] = $v['add_time'] ? date('Y-m-d H:i:s', $v['add_time']) : '';
                if ($v['cleaning_id'] > 0) {
                    $v['cleaner_name'] = \app\admin\model\Cleaner::where(['uid' => $v['cleaning_id']])->value('cleaner_name');
                }

                if ($v['free_id'] > 0) {
                    $elevator_no = Db::name('free_clean')->where(['id' => $v['free_id']])->find();
                    $v['lift_number'] = $elevator_no['elevator_no'];
                    $v['area'] = $elevator_no['address'];
                    $v['buildings'] = $elevator_no['buildings'];
                    $v['l_real_name'] = $elevator_no['proprietor_name'];
                    $v['phone'] = $elevator_no['phone'];
                        // $lift = Lift::where(['lift_number' => $elevator_no['elevator_no']])->find();
                }
            }
            $sql = $this->model->getLastSql();
            $result = array("total" => $count, "rows" => $list, 'sql' => $sql);

            return json($result);
        }
        return $this->view->fetch();
    }

    /**
     * 详情
     */
    public function detail($ids = '')
    {
       // $row = $this->refund_model->get($ids);
        $row = $this->refund_model->alias('s')
            ->join('store_order o','o.id = s.store_order_id','left')
            ->join('lift l','o.lift_id = l.id','left')
            ->where(['s.id'=>$ids])
            ->order('s.add_time desc')
            ->field('s.*,l.*,l.real_name as l_real_name,l.id as l_id,o.*,o.id as o_id,s.id as id,s.refund_reason as refund_reason')
            ->find();
        if (!$row) {
            $this->error(__('No Results were found'));
        }
        if ($this->request->isPost()) {
            $params = $this->request->post("row/a");
            if ($params) {
                try {
                    $params['update_time'] = time();
                    $params['admin_id'] = $this->auth->id;
                    $image_arr = explode('aliyuncs.com', $params['logo']);
                    if ($params['logo']) {
                        $params['logo'] = $image_arr[1];
                    }
                    $result = $row->allowField(true)->save($params);
                    if ($result !== false) {
                        $this->success();
                    } else {
                        $this->error($row->getError());
                    }
                } catch (\think\exception\PDOException $e) {
                    $this->error($e->getMessage());
                } catch (\think\Exception $e) {
                    $this->error($e->getMessage());
                }
            }
            $this->error(__('Parameter %s can not be empty', ''));
        }
        $row['add_time'] = date('Y-m-d H:i:s',$row['add_time']);
        $row['order'] = Db::name('store_order')->where(['order_id'=>$row['order_id']])->find();
        if($row['pay_time']){
            $row['pay_time'] = date('Y-m-d H:i:s',$row['pay_time']);
        }else{
            $row['pay_time'] = '-';
        }
       // $row['lift'] = Db::name('lift')->where(['id'=>$row['order']['lift_id']])->find();

      //  $row['service'] = Db::name('store_order_service')->where(['service_id'=>$row['service_id']])->find();
        $row['lift'] = Db::name('lift')->where(['id'=>$row['lift_id']])->find();
        //$row['order'] = Db::name('store_order')->where(['order_id'=>$row['service']['order_id']])->find();
        if($row['refund_reason'] ==1){   //售后原因
            $row['remark_text'] = '非加装电梯首次服务不满意退款';
        }else if($row['refund_reason'] ==2){
            $row['remark_text'] = '7天内未使用申请退款';
        }else{
            $row['remark_text'] = '其他';
        }
//        if($row['pay_time'] >0){
//            $row['pay_time'] = date('Y-m-d H:i:s',$row['pay_time']);
//        }
        // $row['user'] = Db::name('user')->where(['uid'=>$row['personnel_id']])->find();
        if ($row['personnel_id']) {
            $row['user'] = Db::name('user')->where(['uid'=>$row['personnel_id']])->find();

        }else{
            $json['real_name'] = '暂无';
            $row['user'] = $json;
        }

//        if ($row['cleaning_id'] > 0) {
//            $row['cleaner_name'] = \app\admin\model\Cleaner::where(['id' => $row['cleaning_id']])->value('cleaner_name');
//        }
      //  $row['user'] = User::where(['uid' => $row['personnel_id']])->find();
        $this->view->assign("row", $row);
        return $this->view->fetch();
    }
    /**
     * 审核
     */
    public function service_audit($ids=''){
        if(!$ids){
            $ids = $this->request->request('id');
        }
        $row = $this->model->alias('s')
            ->join('eb_store_order_service os','os.service_id = s.service_id','left')
            ->join('lift l','os.lift_id = l.id','left')
            ->join('store_order o','o.id = os.order_id','left')
            ->where(['s.id'=>$ids])
            ->order('s.add_time desc')
            ->field('s.*,l.*,l.real_name as l_real_name,l.id as l_id,o.*,os.*,o.id as o_id,os.id as os_id,s.id as id,s.number as number,s.remark as remark')
            ->find();
        // $row = $this->service_model->where(['service_id'=>$row['service_id']])->find();
        if (!$row) {
            $this->error(__('No Results were found'));
        }
        if ($this->request->isPost()) {
            $params = $this->request->post("row/a");
            if ($params) {
                try {
//                    $params['up_time'] = time();
//                    $row['status'] = 3;
                    $params['check_time'] = time();
                    if($params['service_status'] == 1){
                        $params['handle_type'] = '';
                        $params['handle_voucher'] = '';
                    }
                    $result = $this->model->where(['id'=>$row['id']])->update($params);
                    if ($result !== false) {
                        $this->success();
                    } else {
                        $this->error($row->getError());
                    }
                } catch (\think\exception\PDOException $e) {
                    $this->error($e->getMessage());
                } catch (\think\Exception $e) {
                    $this->error($e->getMessage());
                }
            }
            $this->error(__('Parameter %s can not be empty', ''));
        }
        //获取详情信息
        //  $this->model->getDetailArr($row);
        if($row['add_time'] >0){
            $row['add_time'] = date('Y-m-d H:i:s',$row['add_time']);
        }
        $row['service'] = Db::name('store_order_service')->where(['service_id'=>$row['service_id']])->find();
        $row['lift'] = Db::name('lift')->where(['id'=>$row['lift_id']])->find();
        //$row['order'] = Db::name('store_order')->where(['order_id'=>$row['service']['order_id']])->find();
        if($row['remark'] ==1){
            $row['remark_text'] = '电梯损坏';
        }else if($row['remark'] ==2){
            $row['remark_text'] = '保洁员态度恶劣';
        }else{
            $row['remark_text'] = '其他';
        }
        if($row['pay_time'] >0){
            $row['pay_time'] = date('Y-m-d H:i:s',$row['pay_time']);
        }
        if($row['cleaning_end_time'] >0){
            $row['cleaning_end_time'] = date('Y-m-d H:i:s',$row['cleaning_end_time']);
        }
        if($row['service_time'] >0){
            $row['service_time'] = date('Y-m-d H:i:s',$row['service_time']);
        }
        // $row['user'] = Db::name('user')->where(['uid'=>$row['personnel_id']])->find();
        //$row['user'] = Db::name('user')->where(['uid'=>$row['personnel_id']])->find();
        if ($row['personnel_id']) {
            $row['user'] = Db::name('user')->where(['uid'=>$row['personnel_id']])->find();

        }else{
            $json['real_name'] = '暂无';
            $row['user'] = $json;
        }
        $this->view->assign("row", $row);
        $this->assignconfig("row", $row);
        return $this->view->fetch();
    }
    /**
     * 详情
     */
    public function after_sale_detail($ids = '')
    {
        if(!$ids) {
            $ids = $this->request->request('id');
        }
        $row = $this->model->alias('s')
            ->join('eb_store_order_service os','os.service_id = s.service_id','left')
            ->join('lift l','os.lift_id = l.id','left')
            ->join('store_order o','o.id = os.order_id','left')
            ->where(['s.id'=>$ids])
            ->order('s.add_time desc')
            ->field('s.*,l.*,l.real_name as l_real_name,l.id as l_id,o.*,os.*,o.id as o_id,os.id as os_id,s.id as id,s.number as number')
            ->find();
        if (!$row) {
            $this->error(__('No Results were found'));
        }
        if ($this->request->isPost()) {
            $params = $this->request->post("row/a");
            if ($params) {
                try {
                    $params['update_time'] = time();
                    $params['admin_id'] = $this->auth->id;
                    $image_arr = explode('aliyuncs.com', $params['logo']);
                    if ($params['logo']) {
                        $params['logo'] = $image_arr[1];
                    }
                    $result = $row->allowField(true)->save($params);
                    if ($result !== false) {
                        $this->success();
                    } else {
                        $this->error($row->getError());
                    }
                } catch (\think\exception\PDOException $e) {
                    $this->error($e->getMessage());
                } catch (\think\Exception $e) {
                    $this->error($e->getMessage());
                }
            }
            $this->error(__('Parameter %s can not be empty', ''));
        }
        if($row['add_time'] >0){
            $row['add_time'] = date('Y-m-d H:i:s',$row['add_time']);
        }
        $row['service'] = Db::name('store_order_service')->where(['service_id'=>$row['service_id']])->find();
        $row['lift'] = Db::name('lift')->where(['id'=>$row['lift_id']])->find();
        if($row['remark'] ==1){
            $row['remark_text'] = '电梯损坏';
        }else if($row['remark'] ==2){
            $row['remark_text'] = '保洁员态度恶劣';
        }else{
            $row['remark_text'] = '其他';
        }
        if($row['pay_time'] >0){
            $row['pay_time'] = date('Y-m-d H:i:s',$row['pay_time']);
        }
        if($row['cleaning_end_time'] >0){
            $row['cleaning_end_time'] = date('Y-m-d H:i:s',$row['cleaning_end_time']);
        }
        if($row['service_time'] >0){
            $row['service_time'] = date('Y-m-d H:i:s',$row['service_time']);
        }
        if ($row['personnel_id']) {
            $row['user'] = Db::name('user')->where(['uid'=>$row['personnel_id']])->find();

        }else{
            $json['real_name'] = '暂无';
            $row['user'] = $json;
        }
        $row['personnel_name'] = User::where(['uid' => $row['personnel_id']])->value('real_name');
        $this->view->assign("row", $row);
        return $this->view->fetch();
    }



    /**
     * 审核
     */
    public function audit($ids=''){
        if(!$ids){
            $ids = $this->request->request('id');
        }
        $row = $this->refund_model->alias('s')
            ->join('store_order o','o.id = s.store_order_id','left')
            ->join('lift l','o.lift_id = l.id','left')
            ->where(['s.id'=>$ids])
            ->order('s.add_time desc')
            ->field('s.*,l.*,l.real_name as l_real_name,l.id as l_id,o.*,o.id as o_id,s.id as id,s.add_time as add_time,o.order_id as o_order_id,s.refund_price as refund_price')
            ->find();
       // $row = $this->service_model->where(['service_id'=>$row['service_id']])->find();
        if (!$row) {
            $this->error(__('No Results were found'));
        }
        if ($this->request->isPost()) {
            $params = $this->request->post("row/a");
            if ($params) {
                try {
                  //  $params['up_time'] = time();
                    $row['status'] = 3;
                    $params['refunded_time'] = time();
                    if($params['audit_status'] == 1){
                       $type = 1;
                    }else if($params['audit_status'] == 3){
                        $type = 2;
                    }
                    $data_refund = [
                        'id'=>$row['id'],
                        'refund_price'=>$row['refund_price'],
                        'type'=>$type,
                    ];
                    $result_info = post_method('https://shopapi.tixiwe.com/api/order/refundPrice',$data_refund);
                    $return = json_decode($result_info,true);
                    write_log($result_info,'退款接口测试');
                    if($return['status'] == '400'){
                        $this->error($return['msg']);
                    }else{
                        $this->success('操作成功');
                    }

//                    $result = $this->refund_model->where(['id'=>$row['id']])->update($params);
//                    if ($result !== false) {
//                        if($params['audit_status'] == 1){
//                           $order_res =  Db::name('store_order')->where(['id'=>$row['store_order_id']])->update(['refund_status'=>2,'status'=>'-2']);
//                           if($order_res){
//
//                               Db::name('store_order_service')->where(['order_id'=>$row['o_order_id']])->delete();
//                           }
//                        }
//                        $this->success();
//                    } else {
//                        $this->error($row->getError());
//                    }
                } catch (\think\exception\PDOException $e) {
                    $this->error($e->getMessage());
                } catch (\think\Exception $e) {
                    $this->error($e->getMessage());
                }
            }
            $this->error(__('Parameter %s can not be empty', ''));
        }
        $row['add_time'] = date('Y-m-d H:i:s',$row['add_time']);
        //$row['order'] = Db::name('store_order')->where(['order_id'=>$row['order_id']])->find();
        if($row['pay_time']){
            $row['pay_time'] = date('Y-m-d H:i:s',$row['pay_time']);
        }else{
            $row['pay_time'] = '-';
        }
            // $row['lift'] = Db::name('lift')->where(['id'=>$row['order']['lift_id']])->find();

            //  $row['service'] = Db::name('store_order_service')->where(['service_id'=>$row['service_id']])->find();
            $row['lift'] = Db::name('lift')->where(['id'=>$row['lift_id']])->find();
        //$row['order'] = Db::name('store_order')->where(['order_id'=>$row['service']['order_id']])->find();
        if($row['refund_reason'] ==1){
            $row['remark_text'] = '非加装电梯首次服务不满意退款';
        }else if($row['refund_reason'] ==2){
            $row['remark_text'] = '7天内未使用申请退款';
        }else{
            $row['remark_text'] = '其他';
        }
//        if($row['pay_time'] >0){
//            $row['pay_time'] = date('Y-m-d H:i:s',$row['pay_time']);
//        }
        // $row['user'] = Db::name('user')->where(['uid'=>$row['personnel_id']])->find();
        if ($row['personnel_id']) {
            $row['user'] = Db::name('user')->where(['uid'=>$row['personnel_id']])->find();

        }else{
            $json['real_name'] = '暂无';
            $row['user'] = $json;
        }
        $this->view->assign("row", $row);
        $this->assignconfig("row", $row);
        return $this->view->fetch();
    }

    public function get_service_sales_reason(){
        $new_list = [
            [
                'value'=>1,
                'name'=>'电梯损坏',
            ],
            [
                'value'=>2,
                'name'=>'保洁员态度恶劣',
            ],
            [
                'value'=>3,
                'name'=>'其它',
            ],
        ];
        $this->success('', null, $new_list);
    }
    public function get_sales_reason(){
        $new_list = [
            [
                'value'=>1,
                'name'=>'非加装电梯首次服务不满意退款',
            ],
            [
                'value'=>2,
                'name'=>'7天内未使用申请退款',
            ],
            [
                'value'=>3,
                'name'=>'其它',
            ],
        ];
        $this->success('', null, $new_list);
    }
}
